package com.supersit.greensproject.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.supersit.greensproject.R;
import com.supersit.greensproject.view.MyTitleBar;
import com.zhy.autolayout.AutoLayoutActivity;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

/**
 * Created by cong on 2016/7/13.
 */
@ContentView(R.layout.activity_web)
public class WebActivity extends AutoLayoutActivity {
    @ViewInject(R.id.webView)
    private WebView webView;
    private MyTitleBar myTitleBar;
    private Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        context = this;
        WebSettings webSettings = webView.getSettings();
        webSettings.setSavePassword(false);
        webSettings.setSaveFormData(false);
        webSettings.setJavaScriptEnabled(true);
        webSettings.setSupportZoom(false);
        myTitleBar = new MyTitleBar(context, findViewById(R.id.wv_title));
        myTitleBar.setTitleText(getResources().getString(R.string.url_title));
        myTitleBar.setChildVisibility(false, myTitleBar.getmImgRight());
        myTitleBar.setImg1Listener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        Intent intent = getIntent();
        String url = intent.getStringExtra("url");
        webView.loadUrl(url);
    }
}
